import React from 'react';
import {Routes, Route, Navigate} from 'react-router-dom'
import './App.css'
import Index from "./pages/Index";
import News from "./pages/News";
import GoodsList from "./pages/GoodsList";
import My from "./pages/My";
import MyNavLink from "./components/MyNavLink";
import NotFound from "./pages/NotFound";
import Login from "./pages/Login";
import Redirect from "./components/Redirect";
import AuthComponent from "./components/AuthComponent";
function App(props) {
    return (
        <div id={'container'}>
            <MyNavLink/>
            <Routes>
                <Route path={'/'} element={<Index/>}></Route>
                <Route path={'/news'} element={<News/>}></Route>
                <Route path={'/goodsList'} element={<AuthComponent><GoodsList/></AuthComponent>}></Route>
                <Route path={'/my'} element={<AuthComponent><My/></AuthComponent>}></Route>
                {/*<Route path={'/home'} element={<Navigate to={'/'}/>}></Route>*/}
                {/*手动实现重定向功能*/}
                <Route path={'/home'} element={<Redirect to={'/'}/>}></Route>
                <Route path={'*'} element={<NotFound/>}></Route>
                <Route path={'/login'} element={<Login/>}></Route>
            </Routes>
        </div>
    );
}

export default App;